package com.ecomm.util.dbadapter;

import com.ecomm.util.DAO;
import com.ecomm.util.Logger;
import com.ecomm.util.SpringUtil;
import com.ecomm.exception.DBException;
import org.apache.commons.logging.Log;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * Created by IntelliJ IDEA.
 * User: Gavin
 * Date: 2007-1-31
 * Time: 23:18:52
 * To change this template use File | Settings | File Templates.
 */
public class SpringDAO implements DAO {
     private static Log log = Logger.getLog(SpringDAO.class);

    public Connection getConnection() throws DBException {
        try{
            return SpringUtil.getConnection();
        }
        catch(Exception e){
           log.error("不能取得一个spring的数据库连接", e);
           throw new DBException("不能取得一个spring的数据库连接");
        }
    }
}
